home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Big Mouth 10
/
Big_Mouth_The_10_1996_-_Side_A.d64
/
dots and boxes
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
5KB
|
245 lines
100 poke 53280,5:poke 53281,11
110 print"[147][155]dots and boxes":gosub5000:gosub5000
120 a=rnd(-ti)
140 print"[147]want the rules? (y/n)
150 [161]a$:[139]a$[178]"y"[167]8000
160 x[178][187](1):[139]a$[179][177]"n"[167]150
170 [156]:[133]"your name .cmdcmdcmd";n$
180 [139]n$[179]"a"[176]n$[177]"z"[167]170
190 [134]b%(49),l%(13,19),t%(6),e%(13)
200 c$(0)[178][200](n$,1):c$[178]"pet"
210 c$(1)[178]"p"
215 [139]c$(0)[178]"p"[167]c$[178]" me":c$(1)[178]"m"
220 [150][165]a(x)[178][181](b%(x)[173]16)
230 z$[178]" ":d$[178]"":r$[178]""
240 [129]i[178]1[164]25:d$[178]d$[170]"":r$[178]r$[170]""
250 z$[178]z$[170]" ":[130]:z$[178]z$[170]""
260 [129]i[178]2[164]8[169]2
270 [135]c$(i),c(i),c(i[170]1):[130]
280 [129]i[178]1[164]24:[135]x:b%(x)[178]65:[130]
500 [143]***draw board***
510 [153]"load";:[129]i[178]1[164]6
520 [153]" (NULL) (NULL) (NULL) (NULL) (NULL) (NULL)"
530 [130]:[153]"":[129]i[178]0[164]4:[153]
540 [153]" ";:[129]j[178]0[164]4
550 [153]" ";[199](65[170]i[172]5[170]j);
560 [130]j,i
570 [153]"":[129]i[178]1[164]7
580 [153][166]28)" "
590 [130]:[153]""
600 [153][166]31)"score"
610 [153][166]29)"you ";c$;"
620 printspc(29)"box sides
630 [153][166]31)"(NULL)-8-(NULL)cmdcmdcmdcmdcmd(NULL) (NULL)cmdcmdcmdcmdcmd4 6cmdcmdcmdcmdcmd(NULL) (NULL)cmdcmdcmdcmdcmd(NULL)-2-(NULL)
640 gosub7040
650 printz$;"do you want to start?"
660 geta$:ifa$="n"then2000
670 x=rnd(1):ifa$<>"y"then660
1000 rem***human move***
1010 g=0:sb=0
1020 printz$;"which box ? ";
1030 geta$:ifa$=""then1030
1040 n=asc(a$)-65
1050 ifn<0orn>24then1030
1060 r=int(n/5):n=n+9+2*r
1070 ifb%(n)<64then1100
1080 printz$;"that box is taken
1090 [141]5000:[137]1020
1100 [153]a$,"which side ? ";
1110 [161]b$:[139]b$[178]""[167]1110
1120 s[178][198](b$)[171]48:[139]s[175]1[167]1110
1130 [139]s[179]2[176]s[177]8[167]1110
1140 [153]s
1170 [139](b%(n)[175]c(s))[178]0[167]1220
1180 [153]z$;"that side is taken
1190 gosub5000
1200 printz$;"which side of box ";
1210 printa$;" ?";:goto1110
1220 gosub6000:printm$+c$(s)
1230 gosub3000
1240 n=n+c(s+1):s=10-s
1250 ifb%(n)>64then1270
1260 gosub3000
1270 ifsbthen1000
2000 rem***pet move***
2010 g=1:sb=0
2020 gosub4000:r=int(n/7)-1
2030 printz$;"i will play box ";
2140 printz$;"i will play box ";
2150 printchr$(n+56-2*r),
2160 print"side";s
2170 gosub6000:printm$+c$(s)
2180 gosub5000:gosub3000
2230 n=n+c(s+1):s=10-s
2240 ifb%(n)<65thengosub3000
2250 ifsbthen2000
2260 goto1000
3000 rem***update statue***
3005 x=c(s)
3010 onfna(n)goto3050,3300,3400
3020 b%(n)=b%(n)+16+x
3030 ifb%(n)>64thengosub7000
3040 return
3050 rem***chain***
3060 sh=0:i=0
3070 k=2^i:if(b%(n)andk)or(k=x)then3250
3080 b=n+c(2*i+3)
3090 iffna(b)<>2then3230
3100 forj=1tolc:l=l%(j,0)
3110 foru=1tol:ifl%(j,u)<>bthen3220
3120 ifj=shthen3020
3130 ifshthen3160
3140 l%(j,l+1)=n:l%(j,0)=l+1
3150 sh=j:goto3250
3160 forv=1tol%(sh,0)
3170 l%(j,l+v)=l%(sh,v):nextv
3180 l%(j,0)=l+l%(sh,0)
3190 forv=0tol%(lc,0)
3200 l%(sh,v)=l%(lc,v):nextv
3210 lc=lc-1:goto3020
3220 nextu,j
3230 ifshthen3020
3240 lc=lc+1:l%(lc,1)=n:l%(lc,0)=1:sh=lc
3250 i=i+1:ifi<4then3070
3260 goto3020
3300 rem***save as capture***
3310 c=c+1:t%(c)=n:goto3020
3400 rem***capture***
3410 forj=1tolc:l=l%(j,0)
3420 foru=1tol:ifl%(j,u)=nthen3440
3430 nextu,j
3440 fori=1toc:ift%(i)=nthen3460
3450 nexti
3460 t%(i)=t%(c):c=c-1
3470 ifl=1thensh=j:goto3190
3480 l%(j,u)=l%(j,l):l%(j,0)=l-1
3490 goto3020
4000 rem***smart moves***
4010 ifc=0then4060
4020 forj=1toc:n=t%(j)
4030 gosub4900
4040 iffna(n+c(2*i+3))>2then4870
4050 nextj
4060 v=0:fori=1tolc
4070 v=v+l%(i,0):next
4080 ifa>vthen4650
4090 rem***3rd phase***
4100 ifc=0then4770
4110 iflc=1thenn=t%(1):goto4860
4120 fori=1tolc:l=l%(i,0)
4130 e%(i)=0:forj=1tol
4140 iffna(l%(i,j))=2then4170
4150 if(l=3)or(l>4)thenn=l%(i,j):goto4860
4160 e%(i)=e%(i)+1
4170 nextj,i
4180 s=0:forj=1tolc
4190 ife%(j)=0then4330
4200 if(l%(j,0)=4)and(e%(j)=1)then4600
4210 ifl%(j,0)=2then4320
4220 p=0:fork=1to4
4230 ifb%(l%(j,k))<48then4260
4240 ifp=0thenp=l%(j,k)
4250 q=l%(j,k)
4260 nextk
4270 n=p:gosub4900:p=p+c(2*i+3)
4280 n=q:gosub4900:q=q+c(2*i+3)
4290 fori=0to3:if(b%(q)and(2^i))then4310
4300 ifp=q+c(2*i+3)then4320
4310 next:goto4600
4320 s=s+1:x=j:ifs=2then4600
4330 nextj
4340 s=0:forj=1tolc
4350 ifx=jthen4370
4360 ifl%(j,0)<3thens=s+1
4370 next:j=x
4380 if(sand1)then4600
4390 rem***sacrifice***
4400 fori=1tol%(j,0):n=l%(j,i)
4410 iffna(n)=2then4430
4420 next
4430 fori=0to3:k=2^i
4440 if(b%(n)andk)then4460
4450 iffna(n+c(2*i+3))<>3then4870
4460 next
4600 rem***capture in chain j***
4610 fork=1tol%(j,0)
4620 ifb%(l%(j,k))>48thenn=l%(j,k):goto4860
4630 nextk
4650 rem***1st phase***
4660 x=65:ifcthenn=t%(1):goto4860
4670 n=int(9+33*rnd(1)):q=n
4680 iffna(n)>1then4740
4690 fori=0to3:k=2^i
4700 if(b%(n)andk)then4730
4710 b=n+c(2*i+3):ifb%(b)=xthen4730
4720 iffna(b)<>2then4870
4730 next
4740 n=n+1:ifn=42thenn=9
4750 ifn<>qthen4680
4760 ifx=65thenx=-1:goto4670
4770 rem***must give away***
4780 m=99:fori=1tolc
4790 ifl%(i,0)<mthenm=l%(i,0):n=l%(i,1)
4800 next:ifm=1then4860
4810 fori=0to3:k=2^i
4820 if(b%(n)andk)then4840
4830 iffna(n+c(2*i+3))=2then4870
4840 next
4850 rem***find side***
4860 gosub4900
4870 s=2*i+2:return
4900 fori=0to3:k=2^i
4910 if(b%(n)andk)thennext
4920 return
5000 rem***delay***
5010 ford=1to2000:next:return
6000 rem***graphics***
6010 m$=""+left$(d$,4+4*r)
6020 m$=m$+left$(r$,4+4*(n-9-7*r))
6030 return
7000 rem***fill in***
7010 s$=" [157][157][157] "+c$(g)+" [157][157][157] [146]"
7020 c(g)=c(g)+1:r=int(n/7)-1:sb=1
7030 gosub6000:printm$+s$
7040 print""
7050 printspc(29)"";c(0)
7060 print"[145]";spc(35);c(1)
7070 a=25-c(0)-c(1)
7080 ifathenreturn
7090 printz$;" game over ":gosub5000
7100 print"[147]":ifc(1)>17then7180
7110 ifc(1)>12then7160
7120 ifc(1)>7then7140
7130 print"i surrender !!":goto 7200
7140 print"you win-but it was close
7150 [137]7200
7160 [153]"i win ! hard luck,";n$
7170 [137]7200
7180 [153]"you were hammered,";n$
7190 [153]"take up chess-it's easier
7200 print"play again?
7210 [161]a$:[139]a$[178]"y"[167] 170
7220 [139]a$[179][177]"n"[167] 7210
7230 [129]t[178]1 [164] 500:[130]:[147]"the main menu/bm",8,1
8000 [143]***rules***
8010 [153]"load dots and boxes-rules
8020 print"1 we take it in turn to";
8030 print" complete one side o";
8040 print"f a box
8050 [153]"2 if you complete the 4th";
8060 [153]" side of a box you win ";
8070 [153]"that box and must play ag";
8080 [153]"ain
8090 print"3 the winner has the most";
8100 print" boxes at the end of t";
8110 print"he game
8120 [153]"4 to play, use a-y to pic";
8130 [153]"k the box then 2,4,6,8 ";
8140 [153]"as indicated for the side
8150 goto170
9000 data"[192][192][192]",1,7,"[157][221][157][221][157][221]",2,-1
9010 data"[221][157][221][157][221]",4,1,"[145][192][192][192]",8,-7
9020 data1,2,3,4,5,6,7,8,14,15,21,22
9030 data28,29,35,36,42,43,44,45,46
9040 data47,48,49